package org.eleorc.ioc.javabased.lite;

import org.eleorc.utils.ApplicationContextUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class AppStart {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Appcfg.class);
        ApplicationContextUtils.printBeanDefinitionInfo(context.getBeanFactory());
        // 如果从IOC容器中获取配置类bean，并调用配置类bean的@Bean实例方法，会怎样？
        System.out.println("==========");
        Appcfg bean = context.getBean(Appcfg.class);
        System.out.println(bean);
        String sex = bean.sex();
        System.out.println(sex);
        System.out.println("==========");
        AppliteCfg bean1 = context.getBean(AppliteCfg.class);
        System.out.println(bean1);
        String name = bean1.name();
        System.out.println(name);
    }
}
